/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       random_monster.h

	$Header: /game/random_monster.h $

	$NoKeywords: $

 ************************************************************************/

#ifndef RANDOM_MONSTER_H_INCLUDED
#define RANDOM_MONSTER_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "army.h"
#include "linkage_data.h"
#include "patrol_type.h"
#include "stationary_adventure_object.h"

enum t_creature_type;

// -------------------------------------------------------------------
// random monster map object
// -------------------------------------------------------------------
class t_random_monster_base : public t_stationary_adventure_object
{
public:
	t_random_monster_base( std::string const& source );

	virtual bool read_from_map( std::streambuf& buffer, t_progress_handler* );
	virtual void place( t_adventure_map& map, t_adv_map_point const& point );
	virtual bool preplacement( t_adventure_map& map, int pass );

private:
	t_town_type				m_alignment;
	t_linkage_data			m_linkage_info;
	t_army::t_events		m_events;
	int						m_max_strength;
	int						m_min_strength;
	t_patrol_type			m_patrol_type;
	int						m_patrol_radius;

	virtual void	get_default_experience_range( int & min, int & max ) const = 0;
	virtual void	get_valid_creatue_levels( int & min, int & max ) const = 0;
};

// -------------------------------------------------------------------
// random monster map object
// Can be any level
// -------------------------------------------------------------------
class t_random_random_monster : public t_random_monster_base
{
public:
	t_random_random_monster( std::string const& source );

private:
	virtual void get_default_experience_range( int & min, int & max ) const;
	virtual void get_valid_creatue_levels( int & min, int & max ) const;
};

// -------------------------------------------------------------------
// t_random_random_monster inline members
// -------------------------------------------------------------------

// -------------------------------------------------------------------
// -------------------------------------------------------------------
inline t_random_random_monster::t_random_random_monster( std::string const& source )
	: t_random_monster_base( source )
{
}


// -------------------------------------------------------------------
// random monster map object
// Random monster for a FIXED level
// -------------------------------------------------------------------
class t_random_monster : public t_random_monster_base
{
public:
	t_random_monster( std::string const& source );

	int get_creature_level( ) const; 

private:
	virtual void get_default_experience_range( int & min, int & max ) const;
	virtual void get_valid_creatue_levels( int & min, int & max ) const;
};

// -------------------------------------------------------------------
// t_random_monster inline members
// -------------------------------------------------------------------

// -------------------------------------------------------------------
// -------------------------------------------------------------------
inline t_random_monster::t_random_monster( std::string const& source )
	: t_random_monster_base( source )
{
}


// -------------------------------------------------------------------
// The level of creatures in this dot
// -------------------------------------------------------------------
inline int t_random_monster::get_creature_level( ) const
{
	return get_major_subtype() + 1;
}



// -------------------------------------------------------------------
// Free functions
// -------------------------------------------------------------------

// Add helpers into army
void add_random_helpers( t_army * army, bool is_ocean, int experience );


#endif // RANDOM_MONSTER_H_INCLUDED
